-
-
Notifications
You must be signed in to change notification settings - Fork 12
debezium/dbz#1518 fix EventDeserializer composition #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
debezium/dbz#1518 fix EventDeserializer composition #19
Conversation
|
@adelajaworowska Unfortunately as you are aware the CI is now broken so I'd be glad if you could run the tests locally and let me know if they passes when the PR is ready for review. Thanks for understanding. |
| new MariadbGtidListEventDataDeserializer()); | ||
| eventDataDeserializers.put(EventType.TRANSACTION_PAYLOAD, | ||
| new TransactionPayloadEventDataDeserializer()); | ||
| new TransactionPayloadEventDataDeserializer(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other deserializers? Does only TransactionPayloadEventDataDeserializer needs to have this parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through all other deserializers' code and TransactionPayloadEventDataDeserializer is the only one that needs a fix
| public static final int OTW_PAYLOAD_COMPRESSION_TYPE_FIELD = 2; | ||
| public static final int OTW_PAYLOAD_UNCOMPRESSED_SIZE_FIELD = 3; | ||
|
|
||
| private final EventDeserializer parentEventDeserializer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this cause cyclic reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I changed the approach.
9c922e6 to
99a612e
Compare
| if (eventDataDeserializer instanceof TransactionPayloadEventDataDeserializer) { | ||
| TransactionPayloadEventDataDeserializer deserializer = | ||
| (TransactionPayloadEventDataDeserializer) eventDataDeserializer; | ||
| if (!compatibilitySet.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this works for newly created EventDeserializer when you first set compatibility mode. But then if someone's case is to remove compatibility mode it will stay inside TransactionPayloadEventDataDeserializer. Doesn't it? I assume always compatibilitySet should propagate relevant to TransactionPayloadEventDataDeserializer no matter if it is set or unset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the library gives us no way to remove compatibilityMode. The only method we can call is setCompatibilityMode() that enforce at least one argument.
But in case it is changed in the future, I modified this code so we just take compatibilitySet as it is and pass it to TransactionPayloadEventDataDeserializer. WDYT now?
9657ad3 to
17553e6
Compare
Signed-off-by: Adela Jaworowska-Nowak <[email protected]>
Signed-off-by: Adela Jaworowska-Nowak <[email protected]>
4d5e649 to
50f3484
Compare
Fixes debezium/dbz#1518
When compatibility mode is set TransactionPayloadEventDataDeserializer() should be aware about it and in deserialize method when it creates new deserializer
EventDeserializer transactionPayloadEventDeserializer = new EventDeserializer(); it should set compatibility mode from top level object.FYI, the issue was also raised in osheroff repo: osheroff#127, osheroff#138 but never addressed.